package com.scedu.springcloud.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.scedu.springcloud.entity.Dept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

//value ="SPRINGCLOUD-PROVIDER-DEPT" 就是注册到eureka里的服务提供者的名称
//fallbackFactory = DeptClientServiceFallBackFactory.class 就是我们写的降级的类
//,fallbackFactory = DeptClientServiceFallBackFactory.class
@FeignClient(value = "SPRINGCLOUD-PROVIDER-DEPT",fallbackFactory = DeptClientServiceFallBackFactory.class)
@Component
public interface DeptClientService  {
    @PostMapping("/add")
    public Integer addDept(Dept dept);
    @GetMapping("/get/{id}")
    public Dept queryById(Long id);
    @GetMapping("/all")
    public List<Dept> queryALL();
}
